import jsonschema


def assert_util(resp, status_code, success, code, message,data):
    # 做断言
    assert status_code == resp.status_code
    # 写规则
    schema = {
        "type": "object",
        "properties": {
            "success": {"const": success},
            "code": {"const": code},
            "message": {"pattern": message},
            "properties": {
            "data": {"type": data}
            }
        }
    }
    jsonschema.validate(instance=resp.json(), schema=schema)
















    # assert success == resp.json().get("success")
    # assert code == resp.json().get("code")
    # assert message in resp.json().get("message")
